import request from './request'

// 获取财务健康评估数据
export function getFinanceHealthData(userId) {
  return request({
    url: '/api/finance/health/data',
    method: 'get',
    params: { userId }
  })
}

// 获取财务健康历史趋势
export function getFinanceHealthTrend(userId, months = 12) {
  return request({
    url: '/api/finance/health/trend',
    method: 'get',
    params: { userId, months }
  })
}

// 获取详细财务指标
export function getDetailedMetrics(userId) {
  return request({
    url: '/api/finance/health/metrics',
    method: 'get',
    params: { userId }
  })
}

// 生成财务健康报告
export function generateFinanceHealthReport(userId, reportType = 'comprehensive') {
  return request({
    url: '/api/finance/health/report/generate',
    method: 'post',
    data: { userId, reportType }
  })
}

// 下载财务健康报告
export function downloadFinanceHealthReport(reportId) {
  return request({
    url: `/api/finance/health/report/download/${reportId}`,
    method: 'get',
    responseType: 'blob'
  })
}

// 获取资产流动性数据
export function getAssetLiquidityData(userId) {
  return request({
    url: '/api/finance/health/liquidity',
    method: 'get',
    params: { userId }
  })
}

// 获取收入稳定性分析
export function getIncomeStabilityAnalysis(userId) {
  return request({
    url: '/api/finance/health/income-stability',
    method: 'get',
    params: { userId }
  })
}

// 获取消费合理性分析
export function getConsumptionAnalysis(userId) {
  return request({
    url: '/api/finance/health/consumption',
    method: 'get',
    params: { userId }
  })
}

// 获取负债承受力分析
export function getDebtCapacityAnalysis(userId) {
  return request({
    url: '/api/finance/health/debt-capacity',
    method: 'get',
    params: { userId }
  })
}

// 更新财务数据
export function updateFinanceData(userId, data) {
  return request({
    url: '/api/finance/health/update',
    method: 'post',
    data: { userId, ...data }
  })
}